package com.cta.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "cta_trunk")
public class Trunk implements BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cta_trunk_seq")
	@SequenceGenerator(name = "cta_trunk_seq", sequenceName = "cta_trunk_seq")
	@Column(name = "id", unique = true, nullable = false)
	private Long id;

	@Column(name = "name", unique = true, nullable = false)
	private String name;
	
	@Column(name = "trunk_no", unique = true)
	private String trunkNo;

	@Column(name = "description")
	private String description;

	@Column(name = "created_date", nullable = false)
	private Date createdDate;

	@Column(name = "modified_date")
	private Date modifiedDate;

	@Column(name = "deleted")
	private Boolean deleted;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "service_provider_id", nullable = false)
	private ServiceProvider serviceProvider;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pbx_id", nullable = false)
	private PBX pbx;
	
	@Column(name = "config_id")
	private Long configId;

	public Trunk() {

	}

	public Trunk(String name, String description, Date createdDate,
			ServiceProvider serviceProvider, PBX pbx, Long configId) {
		this.name = name;
		this.description = description;
		this.createdDate = createdDate;
		this.serviceProvider = serviceProvider;
		this.pbx = pbx;
		this.configId = configId;
	}
	
	public Trunk(String trunkNo, String name, String description, Date createdDate,
			ServiceProvider serviceProvider, PBX pbx, Long configId) {
		this.trunkNo = trunkNo;
		this.name = name;
		this.description = description;
		this.createdDate = createdDate;
		this.serviceProvider = serviceProvider;
		this.pbx = pbx;
		this.configId = configId;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public Date getModifiedDate() {
		return modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		this.modifiedDate = modifiedDate;
	}

	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	public ServiceProvider getServiceProvider() {
		return serviceProvider;
	}

	public void setServiceProvider(ServiceProvider serviceProvider) {
		this.serviceProvider = serviceProvider;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public PBX getPbx() {
		return pbx;
	}

	public void setPbx(PBX pbx) {
		this.pbx = pbx;
	}

	public Long getConfigId() {
		return configId;
	}

	public void setConfigId(Long configId) {
		this.configId = configId;
	}

	public String getTrunkNo() {
		return trunkNo;
	}

	public void setTrunkNo(String trunkNo) {
		this.trunkNo = trunkNo;
	}

}
